Python に switch や case 文がないのはなぜですか?
https://docs.python.org/ja/3/faq/design.html#why-isn-t-there-a-switch-or-case-statement-in-python
You can do this easily enough with a sequence of if... elif... elif... else.
if... elif... elif... elseでできるから
「1つのことをするのに、いろいろなやり方は好ましくない」(Zen of Python)
you can also use a match ... case statement.
Python 3.10〜
非常に大きな数の選択肢から選ぶとき、値を呼び出す関数に対応づける辞書を作れます
functions = {'a': function_1, ...}
ミノ駆動本 6.2 switch文の重複 で案内される方法、ここにあった!!
getattrを使う例
PyCon JP 2021キーノートでBrandtさんが語っていた記憶あり
https://gihyo.jp/news/report/01/pyconjp2021/0002
PEP 3103 – A Switch/Case Statement